home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
time.h.z
/
time.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
4KB
|
142 lines
/*
* time.h --
*
* Header for BSD time calls (plus some other stuff)
*
*
* Copyright 1990, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)time.h 6.4 (Berkeley) 6/24/85
*/
/* time.h 6.1 83/07/29 */
#ident "$Revision: 3.17 $"
#ifndef __SYS_TIME_H__
#define __SYS_TIME_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _KERNEL
/* move this #include here so that ALL instances of 'timezone' agree */
#include <time.h>
#endif
#ifndef _CLOCK_T_
#define _CLOCK_T_
typedef long clock_t; /* Type returned by clock(3C) */
#endif /* !_CLOCK_T_ */
/* needed here according to MIPS ABI draft */
#ifndef _TIME_T_
#define _TIME_T_
typedef long time_t; /* <time> type */
#endif /* !_TIME_T_ */
/*
* Structure returned by gettimeofday(2) system call,
* and used in other calls.
*/
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
/*
* Higher resolution time information, currently only used in /debug,
* but defined by MIPS ABI.
*/
typedef struct timestruc {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
} timestruc_t;
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
#define DST_NONE 0 /* not on dst */
#define DST_USA 1 /* USA style dst */
#define DST_AUST 2 /* Australian style dst */
#define DST_WET 3 /* Western European dst */
#define DST_MET 4 /* Middle European dst */
#define DST_EET 5 /* Eastern European dst */
#define DST_CAN 6 /* Canada */
/*
* Operations on timevals.
*
* NB: timercmp does not work for >= or <=.
*/
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
((tvp)->tv_sec cmp (uvp)->tv_sec || \
(tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
/*
* Names of the interval timers, and structure
* defining a timer setting.
*/
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
#ifndef _KERNEL
extern int gettimeofday(struct timeval *tp,struct timezone *tzp);
extern int settimeofday(struct timeval *tp,struct timezone *tzp);
extern int adjtime(struct timeval *delta, struct timeval *odelta);
extern int getitimer(int, struct itimerval *);
extern int setitimer(int, struct itimerval *, struct itimerval *);
#else
#define USEC_PER_SEC 1000000 /* number of usecs for 1 second */
/*
* macro to round usec to sec in time timeval structure.
* We even go so far as to loop decrementing usec and adding to seconds until
* usec < sec.
*/
#define RNDTIMVAL(t) \
{ \
register struct timeval *tp = (t); \
\
while ( tp->tv_usec >= USEC_PER_SEC ) \
{ \
tp->tv_usec -= USEC_PER_SEC; \
tp->tv_sec++; \
} \
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* __SYS_TIME_H__ */